Small fixes and new warning for Neurons classes. #101
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Small fixes and new warning for Neurons classes.
Fixes:
VectorCells
init if class is initialized directly.None
forOther_Agent
inAgentVectorCells
init, asNone
is not an allowed value.New warning added:
params["n"]
. This is to avoid confusion when a user requests 10 neurons, but ends up with 64, for example. The added code specifically checks whethern
was passed as a parameter, and will not produce a warning ifn
was added in from a default parameter dictionary.New warning examples:
HeadDirectionCells
in 1D environments and toSpeedCell
, if you run something like:you get:
UserWarning: Ignoring 'n' parameter value (3) that was passed for SpeedCell. Only 1 speed cell is needed.
VectorCells
and its child classes, if you run something likethen there's no warning. In the first case, because you didn't specify an
n
value [1] and in the second case, because then
value is not changed.However, if you run
you get:
UserWarning: Ignoring 'n' parameter value (10) that was passed, and setting number of ObjectVectorCell neurons to 58, inferred from the cell arrangement parameter.
[1] To ensure that no superfluous warning is produced in this case, I had to create an extra attribute
_warn_n_change
that can be set in a child class. This allows the init ofVectorCells
to know whethern
was actively passed by the user or was added toparams
at some point during the initialization chain (e.g., from a child class' default parameters).